﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufItem.h"
#include "GnufButtonControl.h"

namespace gnuf {
    
    class Block;
    
    class QtProgressItem;
    class GNUF_BASE_EXPORT ProgressItem final
        : public ItemWith<QtProgressItem>
    {
        CANNOT_COPY_OR_ASSIGN(ProgressItem);
        
    public:
        static const EItemType Type;
        explicit ProgressItem(Block *);
        virtual ~ProgressItem();

        void setValue(int);
        inline int value() const { return m_value; }

        struct Range { int minimum, maximum; };
        void setRange(int, int);
        inline const ProgressItem::Range & range() const {
            return m_range;
        }

    protected:
        // Inherits from ItemWith...
        virtual void onDisconnectFromMyQtItem() override;
        virtual void onPostVisibilityChanged() override;
    private:
        int m_value;
        ProgressItem::Range m_range;
    };
    
}
